drop database if exists ripple_wallet;
create database ripple_wallet default character set utf8mb4 collate utf8mb4_general_ci;

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for account
-- ----------------------------
DROP TABLE IF EXISTS `account`;
CREATE TABLE `account` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID',
  `private_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '私钥',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `main_network` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '主网（1：以太坊，2：波场）',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '地址',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='账户';

-- ----------------------------
-- Records of account
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for capital_account
-- ----------------------------
DROP TABLE IF EXISTS `capital_account`;
CREATE TABLE `capital_account` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `available` decimal(32,8) DEFAULT NULL COMMENT '可用',
  `frozen` decimal(32,8) DEFAULT NULL COMMENT '冻结',
  `user_id` bigint DEFAULT NULL COMMENT '用户id',
  `currency` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '币种（1：USDT）',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='资金账户';

-- ----------------------------
-- Records of capital_account
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for contract_account
-- ----------------------------
DROP TABLE IF EXISTS `contract_account`;
CREATE TABLE `contract_account` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `frozen` decimal(32,8) DEFAULT NULL COMMENT '冻结',
  `margin_balance` decimal(32,8) DEFAULT NULL COMMENT '保证金余额',
  `wallet_balance` decimal(32,8) DEFAULT NULL COMMENT '钱包余额',
  `position_margin` decimal(32,8) NOT NULL DEFAULT '0.00000000' COMMENT '持仓保证金',
  `unrealized_profit_loss` decimal(32,8) DEFAULT NULL COMMENT '未实现盈亏',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID',
  `currency` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '币种（1：USDT）',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='合约账户';

-- ----------------------------
-- Records of contract_account
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for contract_account_detail
-- ----------------------------
DROP TABLE IF EXISTS `contract_account_detail`;
CREATE TABLE `contract_account_detail` (
  `id` bigint NOT NULL COMMENT '主键',
  `user_id` bigint NOT NULL COMMENT '用户id',
  `business_type` varchar(10) NOT NULL COMMENT '业务类型（0已实现盈亏、1资金费用、2手续费、3爆仓清算、4持仓保证金）',
  `operation_type` varchar(10) NOT NULL COMMENT '操作类型（0冻结、1解冻、2增加、3减少）',
  `amount` decimal(32,8) NOT NULL COMMENT '金额',
  `fee_rate` decimal(32,8) DEFAULT NULL COMMENT '费率',
  `symbol_id` bigint DEFAULT NULL COMMENT '币对id',
  `symbol_name` varchar(255) DEFAULT NULL COMMENT '币对名称',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `is_deleted` varchar(10) DEFAULT NULL COMMENT '是否删除（null是、0否）',
  PRIMARY KEY (`id`),
  KEY `contract_account_detail_user_id_index` (`user_id`),
  KEY `contract_account_detail_symbol_id_index` (`symbol_id`),
  KEY `contract_account_detail_create_time_index` (`create_time`),
  KEY `contract_account_detail_business_type_index` (`business_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='合约账户明细';

-- ----------------------------
-- Records of contract_account_detail
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for currency
-- ----------------------------
DROP TABLE IF EXISTS `currency`;
CREATE TABLE `currency` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '状态（1：开启，2：禁用）',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '币种名称',
  `logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'logo',
  `accuracy` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '精度',
  `public_chain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '公链',
  `service_charge_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手续费地址',
  `service_charge_private_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手续费私钥',
  `service_charge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手续费',
  `minimum_recharge_amount` decimal(32,8) DEFAULT NULL COMMENT '最小充值金额',
  `minimum_withdrawal_amount` decimal(32,8) DEFAULT NULL COMMENT '最小提现金额',
  `maximum_withdrawal_amount_per_day` decimal(32,8) DEFAULT NULL COMMENT '单日最大提现金额',
  `confirmation_block_recharge_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '充值区块确认数',
  `node_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '节点地址',
  `smart_contract_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '智能合约地址',
  `api_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'apikey',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='币种列表';

-- ----------------------------
-- Records of currency
-- ----------------------------
BEGIN;
INSERT INTO `currency` VALUES (1562383321713905665, NULL, NULL, '2022-08-24 18:16:26', '2023-04-18 06:18:13', '0', '1', '1', NULL, '18', '1', '0x48923080f86b25572336eb7775b7f8c4a7e9487f', 'd1au3JIJfXb6YhqbA1wovukjMfQybDvK2zB1mOzKUPzURehbTNImZtpcW/c3pifjstxj6CwXpPxxu0WpO62Y5g==', '1', 1.00000000, 1.00000000, 99999999999.00000000, '1', '\r\nhttps://sepolia.infura.io/v3/', '0x7AE401E51A9497725Fa00e71519fa17EFD9D59f2', '');
INSERT INTO `currency` VALUES (1562385084139474945, NULL, NULL, '2022-08-24 18:23:26', '2023-04-18 06:18:13', '0', '1', '1', NULL, '6', '2', 'TBJ16TAKR2TyF32ejMiSHyT5fMnRBwPmCP', 'cVb615FYLCmoaxnDUF1zvXCZdAr+oQmUyRQeqdtjVb/USa0rYKJaLjKmGZ6Ywrxrqfk6K8NFTDH/WUuLbxFcNA==', '1', 1.00000000, 1.00000000, 99999999999.00000000, '1', 'https://api.trongrid.io/', 'TXLAQ63Xg1NAzckPwKHvzw7CSEmLMEqcdj', '');
COMMIT;

-- ----------------------------
-- Table structure for current_block
-- ----------------------------
DROP TABLE IF EXISTS `current_block`;
CREATE TABLE `current_block` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `block_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '当前区块',
  `public_chain` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '公链',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='记录当前区块';

-- ----------------------------
-- Records of current_block
-- ----------------------------
BEGIN;
INSERT INTO `current_block` VALUES (1563162101537681410, NULL, NULL, '2022-08-26 21:51:01', '2023-04-13 07:11:52', '0', '29687463', '2');
INSERT INTO `current_block` VALUES (1563162101978083330, NULL, NULL, '2022-08-26 21:51:01', '2023-04-13 07:11:52', '0', '2400574', '1');
COMMIT;

-- ----------------------------
-- Table structure for funding_rate_settlement_record
-- ----------------------------
DROP TABLE IF EXISTS `funding_rate_settlement_record`;
CREATE TABLE `funding_rate_settlement_record` (
  `id` bigint NOT NULL COMMENT '主键',
  `user_id` bigint NOT NULL COMMENT '用户id',
  `funding_rate` decimal(32,8) DEFAULT NULL COMMENT '资金费率',
  `num` decimal(32,8) DEFAULT NULL COMMENT '资金数量(USDT)',
  `transfer_time` datetime DEFAULT NULL COMMENT '结算时间',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='资金费率结算记录表';

-- ----------------------------
-- Records of funding_rate_settlement_record
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for imputation_record
-- ----------------------------
DROP TABLE IF EXISTS `imputation_record`;
CREATE TABLE `imputation_record` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `account_id` bigint DEFAULT NULL COMMENT '账户id',
  `source_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '来源地址',
  `arrival_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '到账地址',
  `transaction_hash` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '交易哈希',
  `state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '状态（1：归集中，2：成功，3：失败）',
  `quantity` decimal(32,8) DEFAULT NULL COMMENT '数量',
  `currency` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '币种（1：USDT）',
  `main_network` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '主网（1：以太坊，2：波场）',
  `notionalpooling_id` bigint DEFAULT NULL COMMENT '归集id',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='归集列表';

-- ----------------------------
-- Records of imputation_record
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for liquidation_expenses_statistics
-- ----------------------------
DROP TABLE IF EXISTS `liquidation_expenses_statistics`;
CREATE TABLE `liquidation_expenses_statistics` (
  `id` bigint NOT NULL COMMENT '主键',
  `symbol_id` bigint NOT NULL COMMENT '币对id',
  `symbol_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '币对名称',
  `cost` decimal(32,8) NOT NULL COMMENT '强平清算费',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of liquidation_expenses_statistics
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for notification
-- ----------------------------
DROP TABLE IF EXISTS `notification`;
CREATE TABLE `notification` (
  `id` bigint NOT NULL COMMENT '主键',
  `user_id` bigint NOT NULL COMMENT '用户id',
  `is_read` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否已读（0：未读，1：已读）',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '通知标题',
  `message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '消息内容',
  `notice_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '通知类型（字典项：wallet_notice，1：充值，2：提现）',
  `record_id` bigint DEFAULT NULL COMMENT '充提记录id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户消息通知';

-- ----------------------------
-- Records of notification
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for recharge_record
-- ----------------------------
DROP TABLE IF EXISTS `recharge_record`;
CREATE TABLE `recharge_record` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `transaction_hash` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '交易哈希',
  `source_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '来源地址',
  `arrival_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '到账地址',
  `quantity` decimal(32,8) DEFAULT NULL COMMENT '数量',
  `block_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区块高度',
  `block_confirmation_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '区块确认数',
  `state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '状态（1：充值中，2：已完成，3：已失败）',
  `account_id` bigint DEFAULT NULL COMMENT '账户id',
  `minimum_recharge_number` decimal(32,8) DEFAULT NULL COMMENT '最小充值数',
  `block_confirmation_recharge_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '充值区块确认数',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID',
  `public_chain` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '公链',
  `currency` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '币种（1：USDT）',
  `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '充值类型（系统字典：user_fund_recharge_type）',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='充值记录';

-- ----------------------------
-- Records of recharge_record
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for timing_config
-- ----------------------------
DROP TABLE IF EXISTS `timing_config`;
CREATE TABLE `timing_config` (
  `id` bigint NOT NULL COMMENT '主键',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL COMMENT '类型 ( 0 手续费 1 归集 2 保证金 3 黑洞 4 客户冷钱包 )',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci NOT NULL COMMENT '地址',
  `private_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL COMMENT '私钥',
  `timing_period` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL COMMENT '定时周期',
  `to_wallet_proportion` decimal(16,8) DEFAULT NULL COMMENT '打入客户冷钱包的比例',
  `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL COMMENT '任务是否启用 0 否 1 是',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_croatian_ci ROW_FORMAT=DYNAMIC COMMENT='归集相关定时任务配置';

-- ----------------------------
-- Records of timing_config
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for timing_implement_record
-- ----------------------------
DROP TABLE IF EXISTS `timing_implement_record`;
CREATE TABLE `timing_implement_record` (
  `id` bigint NOT NULL COMMENT '主键',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL COMMENT '类型 ( 0 归集  1 保证金  2 黑洞  3 客户冷钱包 )',
  `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_croatian_ci DEFAULT NULL COMMENT '执行结果 ( 0 进行中 1 成功 2 失败 )',
  `source_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '来源地址',
  `arrival_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '到账地址',
  `transaction_hash` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '交易哈希',
  `quantity` decimal(32,8) DEFAULT NULL COMMENT '数量',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_croatian_ci ROW_FORMAT=DYNAMIC COMMENT='归集相关定时任务执行记录';

-- ----------------------------
-- Records of timing_implement_record
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for transfer_record
-- ----------------------------
DROP TABLE IF EXISTS `transfer_record`;
CREATE TABLE `transfer_record` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类型（1：资金-合约，2：合约-资金，3：已实现盈亏，4：资金费用，5：手续费，6：爆仓清算，7：持仓保证金）',
  `currency` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '币种（1：USDT）',
  `quantity` decimal(32,8) DEFAULT NULL COMMENT '数量',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID',
  `contract_id` bigint DEFAULT NULL COMMENT '合约id',
  `contract_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '合约名称',
  `funding_rate` decimal(16,8) DEFAULT NULL COMMENT '资金费率',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='划转记录';

-- ----------------------------
-- Records of transfer_record
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for undo_log
-- ----------------------------
DROP TABLE IF EXISTS `undo_log`;
CREATE TABLE `undo_log` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `branch_id` bigint NOT NULL,
  `xid` varchar(100) NOT NULL,
  `context` varchar(128) NOT NULL,
  `rollback_info` longblob NOT NULL,
  `log_status` int NOT NULL,
  `log_created` datetime NOT NULL,
  `log_modified` datetime NOT NULL,
  `ext` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Records of undo_log
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for withdrawal_record
-- ----------------------------
DROP TABLE IF EXISTS `withdrawal_record`;
CREATE TABLE `withdrawal_record` (
  `id` bigint NOT NULL COMMENT '主键ID',
  `create_by` bigint DEFAULT NULL COMMENT '创建人',
  `update_by` bigint DEFAULT NULL COMMENT '修改人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '0' COMMENT '逻辑删除',
  `account_id` bigint DEFAULT NULL COMMENT '账户id',
  `source_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '来源地址',
  `arrival_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '到账地址',
  `transaction_hash` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '交易哈希',
  `state` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '状态（1：审核中，2：提现中，3：已完成，4：已拒绝，5：已失败）',
  `quantity` decimal(32,8) DEFAULT NULL COMMENT '数量',
  `service_charge` decimal(32,8) DEFAULT NULL COMMENT '手续费',
  `actual_withdrawal_amount` decimal(32,8) DEFAULT NULL COMMENT '实际提现金额',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID',
  `public_chain` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '公链',
  `currency` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '币种（1：USDT）',
  `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '审核备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='提现记录';

-- ----------------------------
-- Records of withdrawal_record
-- ----------------------------
BEGIN;
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
